package com.alex;

import com.alex.config.useprototype.PrototypeConfig;
import com.alex.config.useprototype.ServiceB;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class SpringDemoApplication {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
        ctx.register(PrototypeConfig.class);
        ctx.refresh();
        ServiceB serviceB = ctx.getBean("serviceB", ServiceB.class);
        System.out.println("======111111111=====");
        serviceB.sayServiceA();
        System.out.println("======22222222222=====");
        serviceB.sayServiceA();
        ctx.close();
        System.out.println("spring容器已关闭!");
    }
}
